import ajax from "@lib/ajax";
import { IWork } from "@lib/types";

const URL = 'home';

interface IResponse {
	hot: IWork[];
	vote: IWork[];
	update: IWork[];
	create: IWork[];
}

export default async function() {
	const res = await ajax({
		url: URL
	});
	if (res.success) {
		return (res.data as IResponse);
	} else {
		return new Error(res.error);
	}
}